<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      function qc(arr) {
        // 组装新数组
        var result = [];
        for (var i = 0; i < arr.length; i++) {
          // 判断arr[i]是否在result 当中

          // 如果includes 判断 是 false  ,要执行  push
          // if (!result.includes(arr[i])) {
          //   result.push(arr[i]);
          // }

          // 用 indexOf 判断
          if (result.indexOf(arr[i]) == -1) {
            result.push(arr[i]);
          }
        }
        return result;
      }
      console.log(qc(["c", "a", "z", "a", "a", "b"]));
    </script>
  </body>
</html>
